// Name: HTMLEditor.DesignPanel.debug.js // Assembly: AjaxControlToolkit // Version: 3.5.7.1213 // FileVersion: 3.5.7.1213 Type.registerNamespace("Sys.Extended.UI.HTMLEditor"); Sys.Extended.UI.HTMLEditor.DesignPanel = function(element) { Sys.Extended.UI.HTMLEditor.DesignPanel.initializeBase(this, [element]); this._doc = null; this._updated_now = false; this._updateTimer = null; this._popup = null; this._contextElement = null; this._a_prize = false; this.__stack = null; this._StyleForTyping = null; this.isWord = false; this.isPlainText = false; this.dfltBlockElement = "P"; this._FontNotSet = true; this._design_timer1 = null; this._events$delegate = Function.createDelegate(this, Sys.Extended.UI.HTMLEditor.DesignPanelEventHandler); this._blur$delegate = Function.createDelegate(this, this._blur); this._focus$delegate = Function.createDelegate(this, this._focus_event); } Sys.Extended.UI.HTMLEditor.DesignPanel.prototype = { initialize: function() { Sys.Extended.UI.HTMLEditor.DesignPanel.callBaseMethod(this, "initialize"); }, dispose: function() { Sys.Extended.UI.HTMLEditor.DesignPanel.callBaseMethod(this, "dispose"); }, _activate: function(value) { Sys.Extended.UI.HTMLEditor.DesignPanel.callBaseMethod(this, "_activate"); this._wasFocused = false; this._initIframe(value); this._onDocumentLoaded(); }, _deactivate: function() { this._deactivateCommon(); if (Sys.Extended.UI.HTMLEditor.isIE) { this._doc.open(); this._doc.write(""); this._doc.close(); this.get_element().src = "javascript:false;"; } this._doc = null; Sys.Extended.UI.HTMLEditor.DesignPanel.callBaseMethod(this, "_deactivate"); }, _deactivateCommon: function() { this._editPanel.__blured = false; var aList = this._doc.body.getElementsByTagName("IMG"); for (var i = 0; i < aList.length; i++) { if (aList[i].getAttribute(Sys.Extended.UI.HTMLEditor.attachedIdAttribute) && aList[i].getAttribute(Sys.Extended.UI.HTMLEditor.attachedIdAttribute).length > 0) { try { if (Sys.Extended.UI.HTMLEditor.isIE) { $removeHandler(aList[i], "dragstart", Sys.Extended.UI.HTMLEditor.stopDrag); } else { $removeHandler(aList[i], "draggesture", Sys.Extended.UI.HTMLEditor.stopDrag); } } catch (e) { } } } Sys.Extended.UI.HTMLEditor._removeEvents(this._doc, ["keydown", "keypress", "mousedown", "mouseup", "dblclick"], this._events$delegate); Sys.Extended.UI.HTMLEditor._removeEvents(this.get_element().contentWindow, ["blur"], this._blur$delegate); Sys.Extended.UI.HTMLEditor._removeEvents(this.get_element().contentWindow, ["focus"], this._focus$delegate); }, _initIframe: function(value) { if (!Sys.Extended.UI.HTMLEditor.isIE) { this._savedValue = value; this._absAndFixedParents = this._getAbsAndFixedParents(); } var str = Sys.Extended.UI.HTMLEditor.Trim(this._prepareContent(value)); this._doc = this.get_element().contentWindow.document; if (!Sys.Extended.UI.HTMLEditor.isIE) { this._doc.designMode = "on"; } this._doc.open(); this._doc.write("
" + str + ""); this._doc.close(); this._doc.id = "EditorDocument"; if (Sys.Extended.UI.HTMLEditor.isIE) { this._doc.body.contentEditable = true; this._tryForward = true; } }, _blur: function(event) { this._editPanel.__blured = true; if (!Sys.Extended.UI.HTMLEditor.isIE && this._design_timer1 != null) { clearTimeout(this._design_timer1); this._design_timer1 = null; } if (!this.isPopup) { this._editPanel._validate(event, null); } return true; }, _focus_event: function() { this._editPanel.__blured = false; if (Sys.Extended.UI.HTMLEditor.isIE) { this._really_focused(); } else { var panel = this; Sys.Extended.UI.HTMLEditor.LastFocusedEditPanel = this._editPanel; if (this._design_timer1 == null) { this._design_timer1 = setTimeout(function() { panel._really_focused(); panel._design_timer1 = null; }, 0); } } return true; }, _getAbsAndFixedParents: function() { var el = this.get_element(); var str = ""; while (el != null && el.tagName && el.tagName.toLowerCase() != "body") { str += el.tagName; if (el.style.position == "absolute" || el.style.position == "fixed") { str += ": " + el.style.position; } str += "\n"; el = el.parentNode; } return str; }, _onDocumentLoaded: function() { var editor = this; if (!Sys.Extended.UI.HTMLEditor.isIE) { var absAndFixedParents = this._getAbsAndFixedParents(); if (absAndFixedParents != this._absAndFixedParents) { this._initIframe(this._savedValue); setTimeout(function() { editor._onDocumentLoaded() }, 10); return; } } try { if (!Sys.Extended.UI.HTMLEditor.isIE) { this._doc.queryCommandValue("forecolor"); if (Sys.Extended.UI.HTMLEditor.isSafari || Sys.Extended.UI.HTMLEditor.isOpera) { if (!Sys.Extended.UI.HTMLEditor.isReallyVisible(this.get_element())) { setTimeout(function() { editor._onDocumentLoaded() }, 10); return; } } } var temp = editor._doc.body.innerHTML; } catch (e) { setTimeout(function() { editor._onDocumentLoaded() }, 10); // waiting for loading return; } this._afterBodyIsFormed(); setTimeout(function() { editor._activateFinished(); if (Sys.Extended.UI.HTMLEditor.isIE && !editor._editPanel.get_autofocus()) { editor._getSelection().empty(); } }, 0); }, _afterBodyIsFormed: function() { var editor = this; Sys.Extended.UI.HTMLEditor._addEvents(this._doc, ["keydown", "keypress", "mousedown", "mouseup", "dblclick"], this._events$delegate); Sys.Extended.UI.HTMLEditor._addEvents(this.get_element().contentWindow, ["blur"], this._blur$delegate); Sys.Extended.UI.HTMLEditor._addEvents(this.get_element().contentWindow, ["focus"], this._focus$delegate); Sys.Extended.UI.HTMLEditor.inspectForShadows(editor._doc.body); var body = this._doc.body; if (body.childNodes.length == 1 && body.firstChild.tagName && body.firstChild.tagName.toUpperCase() == "DIV" && body.firstChild.style.cssText.length > 0 && body.firstChild.style.direction.length > 0 && Sys.Extended.UI.HTMLEditor.getStyle(body.firstChild, "position") != "absolute") { body.style.cssText = body.firstChild.style.cssText; var temp = body.firstChild; while (temp.firstChild) body.insertBefore(temp.firstChild, temp); body.removeChild(temp); } editor._clearP(); }, _getContent: function() { if (this._popup != null) { if (typeof this._popup._forceImClose == "function") { var func = this._popup._forceImClose; func(this._popup._iframe.contentWindow); } } this._clearP(); var temp; if (Sys.Extended.UI.HTMLEditor.isIE) { Sys.Extended.UI.HTMLEditor.spanJoiner(this._doc.body, this._doc); temp = Sys.Extended.UI.HTMLEditor.getHTML(this._doc.body, false, true); temp = temp.replace(/(]*?>)\s*( )\s*(<\/p[^>]*?>)/ig, "$1
$3");
temp = ((this._doc.body.style.cssText.length > 0) ? "